import { DocumentEventCenter } from "./DocumentEventCenter";
import { ShaderMgr } from "./ShaderMgr";

export class InitFlow{
    private _gl:WebGL2RenderingContext|WebGLRenderingContext;
    private _canvas : HTMLCanvasElement;

    init(){
        DocumentEventCenter.__init__();
        this._canvas = document.getElementById("canvas_id") as HTMLCanvasElement;
        this._gl = getWebGLContext(this._canvas);
        ShaderMgr.gl = this._gl;
        ShaderMgr.canvas = this._canvas;
        this._gl.enable(this._gl.DEPTH_TEST);
        this._gl.enable(this._gl.POLYGON_OFFSET_FILL);
        if(! this._gl || ! this._canvas) console.error("init fail this.gl:",this._gl,this._canvas);
        else console.log("init suc  !!!!");
    }
}

